bimport { loadImage } from './utils.js';

let playerImage;

function loadPlayerImage() {
    loadImage('./path/to/player.png')
        .then(img => {
            playerImage = img;
        })
        .catch(error => {
            console.error('Failed to load player image:', error);
        });
}

export function drawPlayer(ctx) {
    if (playerImage && playerImage.complete) {
        ctx.drawImage(playerImage, 100, 100);
    } else {
        ctx.fillStyle = 'green';
        ctx.fillRect(100, 100, 50, 50);
    }
}

loadPlayerImage();